<!--
  ~ /**
  ~  *                             _ooOoo_
  ~  *                            o8888888o
  ~  *                            88" . "88
  ~  *                            (| -_- |)
  ~  *                            O\  =  /O
  ~  *                         ____/`---'\____
  ~  *                       .'  \\|     |//  `.
  ~  *                      /  \\|||  :  |||//  \
  ~  *                     /  _||||| -:- |||||-  \
  ~  *                     |   | \\\  -  /// |   |
  ~  *                     | \_|  ''\---/''  |   |
  ~  *                     \  .-\__  `-`  ___/-. /
  ~  *                   ___`. .'  /--.--\  `. . __
  ~  *                ."" '<  `.___\_<|>_/___.'  >'"".
  ~  *               | | :  `- \`.;`\ _ /`;.`/ - ` : | |
  ~  *               \  \ `-.   \_ __\ /__ _/   .-` /  /
  ~  *          ======`-.____`-.___\_____/___.-`____.-'======
  ~  *                             `=---='
  ~  *          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ~  *                     佛祖保佑        永无BUG
  ~  *            佛曰:
  ~  *                   写字楼里写字间，写字间里程序员；
  ~  *                   程序人员写程序，又拿程序换酒钱。
  ~  *                   酒醒只在网上坐，酒醉还来网下眠；
  ~  *                   酒醉酒醒日复日，网上网下年复年。
  ~  *                   但愿老死电脑间，不愿鞠躬老板前；
  ~  *                   奔驰宝马贵者趣，公交自行程序员。
  ~  *                   别人笑我忒疯癫，我笑自己命太贱；
  ~  *                   不见满街漂亮妹，哪个归得程序员？
  ~ */
  -->

<!DOCTYPE html>
<html lang="en" xmlns="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>用户登录</title>
    <!--<link rel="stylesheet" href="/layui-v2.5.7/layui/css/layui.css">-->
<!-- 引入 模板 -->
     <link rel="stylesheet" th:href="@{/layui-v2.5.7/layui/css/layui.css}"/>
    <style>
        body{
            height: 100%;
            width: 100%;
            background-size: cover;
            background-repeat: no-repeat;
        }
        *{
            border-radius: 0 !important;
        }
        .login-box{
            margin-top: 150px;
        }
        .login-panel{
            padding:10px;
            background: #fff;
        }
        .footer {
            margin-left: 685px;
            margin-top: 42px;
        }
        .forget:hover{
            color: red;
        }
    </style>

</head>
<body class="layui-bg-gray">
<!--登录/注册框-->
<div class="layui-container login-box">
    <div class="layui-row">
        <div class="layui-col-md4 layui-col-md-offset4 login-panel">
            <div class="layui-tab layui-tab-brief">
                <ul class="layui-tab-title">
                    <li class="layui-this">用户登录</li>
                    <li>用户注册</li>
                    <li>管理员登录</li>
                </ul>
                <div class="layui-tab-content">
                    <!--登录tab-->
                    <div class="layui-tab-item layui-show">
                        <form class="layui-form layui-form-pane" id="loginForm">
                            <!--                                四种会话跟踪技术之一：隐藏域传值-->
                            <input type="hidden" name="method" value="login">
                            <div class="layui-form-item">
                                <label  class="layui-form-label">
                                    <i class="layui-icon layui-icon-username"></i>
                                </label>
                                <div class="layui-input-block">
                                    <input type="text" name="username" class="layui-input" placeholder="请输入账号" required lay-verify="required">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label  class="layui-form-label">
                                    <i class="layui-icon layui-icon-password"></i>
                                </label>
                                <div class="layui-input-block">
                                    <input type="password" name="password" class="layui-input" placeholder="请输入密码" required lay-verify="required" autocomplete="off">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <input type="checkbox"  name="save" class="layui-bg-blue" title="保存一周" lay-skin="primary">
                            </div>
                            <div class="layui-form-item">
                                <button class="layui-btn layui-btn-normal layui-btn-fluid"  lay-submit lay-filter="formLogin">登录</button>
                            </div>
                            <div class="layui-form-item">
                                <a  href="forget.html" class="forget" style="margin-left: 140px">忘记密码?</a>
                            </div>
                        </form>
                    </div>
                    <!--注册tab-->
                    <div class="layui-tab-item">
                        <form class="layui-form layui-form-pane" id="regForm">
                            <!-- 隐藏域-->
                            <!--<input type="hidden" name="method" value="reg">-->
                            <div class="layui-form-item">
                                <label  class="layui-form-label">
                                    <i class="layui-icon layui-icon-username"></i>
                                </label>
                                <div class="layui-input-block">
                                    <input type="text" name="username" lay-verType="tips" lay-reqText="请输入账号" class="layui-input"  placeholder="请输入账号" required lay-verify="required">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label  class="layui-form-label">
                                    <i class="layui-icon layui-icon-password"></i>
                                </label>
                                <div class="layui-input-block">
                                    <input type="password" id="pwd" name="password" lay-verType="tips" lay-reqText="请输入密码"  class="layui-input" placeholder="请输入密码" required lay-verify="required" autocomplete="off">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label  class="layui-form-label">
                                    <i class="layui-icon layui-icon-password"></i>
                                </label>
                                <div class="layui-input-block">
                                    <input type="password" name="relpass" lay-verType="tips" lay-reqText="请输入重复密码"  class="layui-input" placeholder="请输入重复密码" required lay-verify="required|repass" autocomplete="off">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label  class="layui-form-label">
                                    <i class="layui-icon layui-icon-cellphone"></i>
                                </label>
                                <div class="layui-input-block">
                                    <input type="number" name="tel" lay-verType="tips" lay-reqText="请输入手机号" class="layui-input" placeholder="请输入手机号" required lay-verify="required|phone" autocomplete="off">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <input type="radio" name="sex" value="男" title="男" checked>
                                    <input type="radio" name="sex" value="女" title="女">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <input type="checkbox" name="userauth" lay-verType="alert" value="ok" class="layui-bg-blue" title="我已阅读<a href='#'>《用户协议》</a>" lay-verify="reqChecked" lay-skin="primary">
                            </div>
                            <div class="layui-form-item">
                                <button class="layui-btn layui-btn-normal layui-btn-fluid" lay-submit lay-filter="formReg">确认注册</button>
                            </div>
                        </form>
                    </div>
                    <!--登录tab-->
                    <div class="layui-tab-item  ">
                        <form class="layui-form layui-form-pane" id="adminloginForm">
                            <div class="layui-form-item">
                                <label  class="layui-form-label">
                                    <i class="layui-icon layui-icon-username"></i>
                                </label>
                                <div class="layui-input-block">
                                    <input type="text" name="username" class="layui-input" placeholder="请输入账号" required lay-verify="required">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label  class="layui-form-label">
                                    <i class="layui-icon layui-icon-password"></i>
                                </label>
                                <div class="layui-input-block">
                                    <input type="password" name="password" class="layui-input" placeholder="请输入密码" required lay-verify="required" autocomplete="off">
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <input type="checkbox"  name="save" class="layui-bg-blue" title="保存一周" lay-skin="primary">
                            </div>
                            <div class="layui-form-item">
                                <button class="layui-btn layui-btn-normal layui-btn-fluid"  lay-submit lay-filter="adminformLogin">登录</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="footer">Copyright &copy; 2009-2013 Fun68.Cn <a href="zhuye.html">哈喽出行</a> 版权所有
</div>
</div>
<!--<script src="../layui-v2.5.7/layui/layui.js"></script>-->
<script th:src="@{/layui-v2.5.7/layui/layui.js}"></script>
<script>
    layui.use(['element','form','jquery'],function(){
        var ele = layui.element;
        var form = layui.form;
        var $ = layui.jquery;

        //登录操作回调
        form.on('submit(formLogin)',function(data){
            var data = $('#loginForm').serialize();
            $.get(`/adminUser/login`,data,function (respData){
                if (respData.code === 0){
                    sessionStorage.setItem("uname",respData.data.uname);
                    location.href = 'zhuye.html';
                  //  location.href = '/admin/main.html'
                }else {
                    layer.alert(respData.msg)
                }
            })
            return false;
        })

        //管理员登录操作回调 =========================20210319
        form.on('submit(adminformLogin)',function(data){
            var data = $('#adminloginForm').serialize();
            $.get(`/adminUser/login`,data,function (respData){
                if (respData.code === 0){
                    location.href = '/adminUser/toMain';
                }else {
                    layer.alert(respData.message)
                }
            })
            return false;
        })

        //注册操作回调
        form.on('submit(formReg)',function(){
            var data = $('#regForm').serialize();
            $.get(`user?method=reg`,data,function (resp){
                if (resp.code == 0){
                    layer.msg(resp.msg,function (){
                        location.reload();
                    })
                }else{
                    layer.msg(resp.msg,{icon:5})
                }
            })
            return false;
        })

        //自定义验证
        form.verify({
            reqChecked:function(value,item){
                if(!item.checked){
                    return '必须同意用户协议';
                }
            },
            repass:function(value,item){
                if($('#pwd').val() != value){
                    return '两次密码不一致';
                }
            }
        })
    })
</script>
</body>
</html>
